import request from "../request";
import type { ApiResponse } from "../request";

// 创建会话

export interface CreateSessionRequestResponseType {
  id: string;
  sessionName: string;
  mediaAccessCode: number;
  lastUseModel: string;
  updateTime: string;
}

// 更新后的会话创建请求类型
export interface CreateSessionRequestType {
  sessionId?: string;
  content: string;
  model: string;
  enableDeepThink?: boolean;
  searchNetwork?: boolean;
}

// 创建新会话
export const createSession = async (
  params: CreateSessionRequestType
): Promise<ApiResponse<CreateSessionRequestResponseType>> => {
  // 确保使用正确的端点
  const endpoint = params.sessionId
    ? `/ai/chat/session/${params.sessionId}/save`
    : "/ai/chat/session/save";

  return request.post(endpoint, params);
};
